#include<stdio.h>
int main()
{
	int a[1001],b[1001],c[1001];
	int n,x=0,y=0,i=0,m,k,j=0,index=0;
	scanf("%d",&n);
	for(k=0;k<n;k++)
	{
		scanf("%d",&m);
		if(m%2!=0)
		b[j++]=m;
		else 
		c[i++]=m;
	}
	while(x<j||y<i)//j是奇数，i是偶数，j是VIP；
	{
		if(x<j)
		a[index++]=b[x];
		if(x+1<j)
		a[index++]=b[x+1];
		x+=2;
		if(y<i)
		a[index++]=c[y];
		y++;
	} 
	 for(i=0;i<index-1;i++)
	 printf("%d ",a[i]);
	 printf("%d",a[index-1]);//注意空格问题
	 return 0;
}
